/***********************************************************************
 * Module:  ControlTypeService.java
 * Author:  Administrator
 * Purpose: Defines the Class ControlTypeService
 ***********************************************************************/

package ishitong.rvims.control.service;

import ishitong.rvims.control.persistence.ControlTypeMapper;
import ishitong.core.common.SQLSelectWhere;
import ishitong.rvims.domain.control.ControlType;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

/** @pdOid 5a141c21-599c-4490-b39f-821a1abd7f36 */
@Service
public class ControlTypeService {
   /** @pdOid e777834c-299f-4e22-8a1c-e73c3e176114
       @pdRoleInfo migr=yes name=ControlTypeMapper assc=association2 */
   @Autowired
   private ControlTypeMapper controlTypeMapper;
   
   /** @param sQLSelectWhere
    * @exception Exception
    * @pdOid c1d2fef8-435d-4e2a-ab57-799eca5c8e1b */
   public List<ControlType> findControlTypeList(SQLSelectWhere sQLSelectWhere) throws Exception {
      return controlTypeMapper.selectControlTypeList(sQLSelectWhere);
   }
   
   /** @param controlTypeId
    * @exception Exception
    * @pdOid 8525730d-3497-45af-b302-1a711e8b2d72 */
   public ControlType getControlTypeById(String controlTypeId) throws Exception {
      return controlTypeMapper.selectControlTypeById(controlTypeId);
   }
   
   /** @param controlType
    * @exception Exception
    * @pdOid 0b2dec3d-e739-49a6-a112-c68114bf8fb0 */
   public void saveControlType(ControlType controlType) throws Exception {
      if (StringUtils.isBlank(controlType.getId())) {
    	 controlTypeMapper.insertControlType(controlType);
    	 
      } else {
    	 controlTypeMapper.updateControlType(controlType);
      }
   }
   
   /** @param controlTypeIds
    * @exception Exception
    * @pdOid f6fe2ef5-9885-4829-aa91-910d831fc122 */
   public void deleteControlTypeByIds(String controlTypeIds) throws Exception {
      controlTypeMapper.deleteControlTypeByIds(controlTypeIds);
   }
   
   /** @param sQLSelectWhere
    * @pdOid f14459c4-b38a-4706-9819-3d1bd8975102 */
   public int getControlTypeTotal(SQLSelectWhere sQLSelectWhere) {
      return controlTypeMapper.selectControlTypeTotal(sQLSelectWhere);
   }

}